/*
 * Packet.cpp
 *
 *  Created on: 2014. 6. 25.
 *      Author: jjaehuny
 */

#include "Packet.h"

#include "../Memory/Lock_Function_new_Pool.h"
#include "../Memory/Function_new_Pool.h"

namespace Framework { namespace Network {

::Framework::Memory::Lock_Function_new_Pool<::Framework::Network::Packet> s_clsPacket_LockFunctionNewPool;
::Framework::Memory::Lock_Function_new_Pool<::Framework::Network::Packet> s_clsPacket_FunctionNewPool;

std::shared_ptr<::Framework::Network::Packet> create_packet_multithread()
{
	return s_clsPacket_LockFunctionNewPool.NEW();
}

std::shared_ptr<::Framework::Network::Packet> create_packet_singlethread()
{
	return s_clsPacket_FunctionNewPool.NEW();
}


} /*Network*/ } /*Framework*/



namespace Framework { namespace Network {

Packet::Packet()
{
	// TODO Auto-generated constructor stub

	buffer_.reserve(1024);
	clsHeader_.clear();

	head_length_ = 0;
	body_length_ = 0;

	send_length = 0;
	command = 0;

	buffer_.clear();
}

Packet::~Packet() {
	// TODO Auto-generated destructor stub
}

void
Packet::Initialize()
{
	clsHeader_.clear();

	head_length_ = 0;
	body_length_ = 0;

	send_length = 0;
	command = 0;

	buffer_.clear();
}

void
Packet::Finalize()
{

}

std::shared_ptr<Packet>
Packet::CAPTURE()
{
	return shared_from_this();
}

char *
Packet::Buffer()
{
	return buffer_.data();
}

} /*Network*/ } /*Framework*/
